import Vue from 'vue'
import Router from 'vue-router'

import Login from '../views/Login/Login'
import NotFound from '../views/Error/NotFound'
import FindPwd from "../views/Login/FindPwd";
import personalEdit from "../views/Func/PersonalEdit"

import Main from '../views/AfterLogin/Main'


import UserList from '../views/Func/UserControl/List'
import UserProfile from '../views/Func/PersonalFile'
import EditUser from "../views/Func/UserControl/EditUser";
import test from "../test";
import addUser from "../views/Func/UserControl/AddUser"

import EvidenceList from '../views/Func/EvidenceControl/List'
import AddEvidence from '../views/Func/EvidenceControl/AddEvidence'
import EditEvidence from '../views/Func/EvidenceControl/EditEvidence'

import OrganizationList from "../views/Func/OrgnizationControl/List"
import AddOrganization from "../views/Func/OrgnizationControl/AddOrganization"
import EditOrganization from "../views/Func/OrgnizationControl/EditOrganization"

import IdentifyList from "../views/Func/IdentifyControl/List"
import AddIdentify from "../views/Func/IdentifyControl/AddIdentify"

import IdentifyResultList from "../views/Func/IdentifyResult/List"
import AddIdentifyResult from "../views/Func/IdentifyResult/AddIdentifyResult"

import IdentifyProvideList from "../views/Func/IdentifyProvide/List"
import AddIdentifyProvide from "../views/Func/IdentifyProvide/AddIdentifyProvide"
import EditIdentifyProvide from "../views/Func/IdentifyProvide/EditIdentifyProvide"

import Instrument from "../views/Func/InstumentControl/List"
import AddInstrument from "../views/Func/InstumentControl/AddInstrument"
import EditInstrument from "../views/Func/InstumentControl/EditIntrument"

import IInstrument from "../views/IdentifyInstitution/InstumentControl/List"
import IAddInstrument from "../views/IdentifyInstitution/InstumentControl/AddInstrument"
import IEditInstrument from "../views/IdentifyInstitution/InstumentControl/EditIntrument"
import IEvidenceList from "../views/IdentifyInstitution/EvidenceControl/List"
import IIdentifyList from "../views/IdentifyInstitution/IdentifyControl/List"
import IIdentifyResultList from "../views/IdentifyInstitution/IdentifyResult/List"
import IIdentifyProvideList from "../views/IdentifyInstitution/IdentifyProvide/List"
import IAddIdentifyResult from "../views/IdentifyInstitution/IdentifyResult/AddIdentifyResult"
import IAddIdentifyProvide from "../views/IdentifyInstitution/IdentifyProvide/AddIdentifyProvide"
import IEditIdentifyProvide from "../views/IdentifyInstitution/IdentifyProvide/EditIdentifyProvide"

import CEvidenceList from "../views/Character/EvidenceControl/List"
import CAddEvidence from "../views/Character/EvidenceControl/AddEvidence"
import CIdentifyList from "../views/Character/IdentifyControl/List"
import CIdentifyResultList from "../views/Character/IdentifyResult/List"
import CidentifyApplication from "../views/Character/IdentifyApplication/List"
import CaddIdentifyProvide from "../views/Character/IdentifyApplication/AddIdentify"

Vue.use(Router);

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/login',
      component: Login
    },
    {
      path: '/main',
      component: Main,
      props: true,
      children: [{
          path: '/func/profile',
          name: 'UserProfile',
          component: UserProfile,
          props: true
        },
        {
          path: '/func/userList',
          component: UserList,
          props: true,
        },
        {
          path: '/func/evidenceList',
          component: EvidenceList,
          props: true,
        },
        {
          path: '/func/IevidenceList',
          component: IEvidenceList,
          props: true,
        },
        {
          path: '/func/CevidenceList',
          component: CEvidenceList,
          props: true,
        },
        {
          path: '/func/organizationList',
          component: OrganizationList,
          props: true,
        },
        {
          path: '/func/identifyList',
          component: IdentifyList,
          props: true,
        },
        {
          path: '/func/IidentifyList',
          component: IIdentifyList,
          props: true,
        },
        {
          path: '/func/CidentifyList',
          component: CIdentifyList,
          props: true,
        },
        {
          path: '/func/CidentifyApplication',
          component: CidentifyApplication,
          props: true,
        },
        {
          path: '/func/identifyResult',
          component: IdentifyResultList,
          props: true,
        },
        {
          path: '/func/CidentifyResult',
          component: CIdentifyResultList,
          props: true,
        },
        {
          path: '/func/IidentifyResult',
          component: IIdentifyResultList,
          props: true,
        },
        {
          path: '/func/identifyProvide',
          component: IdentifyProvideList,
          props: true,
        },
        {
          path: '/func/IidentifyProvide',
          component: IIdentifyProvideList,
          props: true,
        },
        {
          path: '/func/Instrument',
          component: Instrument,
          props: true,
        },
        {
          path: '/func/IInstrument',
          component: IInstrument,
          props: true,
        },

        {
          path : '/addUser',
          name : 'AddUser',
          component : addUser
        },
        {
          path : '/addEvidence',
          name : 'AddEvidence',
          component : AddEvidence
        },
        {
          path : '/CaddEvidence',
          name : 'CAddEvidence',
          component : CAddEvidence
        },
        {
          path : '/addOrganization',
          name : 'AddOrganization',
          component : AddOrganization
        },
        {
          path : '/addIdentify',
          name : 'AddIdentify',
          component : AddIdentify
        },
        {
          path : '/addIdentifyResult',
          name : 'AddIdentifyResult',
          component : AddIdentifyResult
        },
        {
          path : '/IaddIdentifyResult',
          name : 'IAddIdentifyResult',
          component : IAddIdentifyResult
        },
        {
          path : '/addIdentifyProvide',
          name : 'AddIdentifyProvide',
          component : AddIdentifyProvide
        },
        {
          path : '/IaddIdentifyProvide',
          name : 'IAddIdentifyProvide',
          component : IAddIdentifyProvide
        },
        {
          path : '/addInstrument',
          name : 'AddInstrument',
          component : AddInstrument
        },
        {
          path : '/IaddInstrument',
          name : 'IAddInstrument',
          component : IAddInstrument
        },
        {
          path : '/CaddIdentifyProvide/:qid',
          name : 'CaddIdentifyProvide',
          component : CaddIdentifyProvide
        },

        {
          path : '/editEvidence/:wid',
          name : 'AdmEditEvidence',
          component : EditEvidence,
          props : true
        },
        {
          path : '/editOrganization/:jid',
          name : 'AdmEditOrganization',
          component : EditOrganization,
          props : true
        },
        {
          path : '/editUser/:uid',
          name : 'AdmEditUser',
          component : EditUser,
          props : true
        },
        {
          path : '/editIdentifyProvide/:qid',
          name : 'AdmEditIdentifyProvide',
          component : EditIdentifyProvide,
          props : true
        },
        {
          path : '/IeditIdentifyProvide/:qid',
          name : 'IAdmEditIdentifyProvide',
          component : IEditIdentifyProvide,
          props : true
        },
        {
          path : '/editInstrument/:yid',
          name : 'AdmEditInstrument',
          component : EditInstrument,
          props : true
        },
        {
          path : '/IeditInstrument/:yid',
          name : 'IAdmEditInstrument',
          component : IEditInstrument,
          props : true
        },

      ]
    },
    {
      path: '/goHome',
      redirect: '/main'
    },
    {
      path: '/personalEdit',
      name : 'personalEdit',
      component : personalEdit,
      props : true
    },
    {
      path: '/findpwd',
      component: FindPwd
    },
    {
      path: '/test',
      component: test
    }
  ]
})

/*Router.beforeEach((to, from, next) => {
  //NProgress.start();
  console.log(localStorage.getItem("token_only")+"dada")
  if (to.path === '/login') {
    localStorage.removeItem('token_only');
  }
  let user = localStorage.getItem("token_only")

  if (user.length===0 && to.path !== '/login') {
    next({ path: '/login' })
  } else {
    next()
  }
})*/
